/*
 * @Author: 孙文豪
 * @Description: 
 * @Date: 2024-03-04 13:44:52
 * @LastEditTime: 2024-03-27 14:27:02
 * @LastEditors: 孙文豪
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  build: {
    outDir: '../WarehouseManagementPro/nginx-1.22.1/html'
  },
  base: './',
  server: {
    // http://localhost:5173/api/login -> http://www.test.com/login
    proxy: {
      //api是自行设置的请求前缀，任何请求路径以/api开头的请求将被代理到对应的target目标
      '/api': {
        target: 'https://doc.rongdasoft.com', //目标域名
        changeOrigin: true, //需要代理跨域
        // rewrite: (path) => path.replace(/^\/api/, ''), //路径重写，把'/api'替换为''
      },
    },
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },

  css: {
    preprocessorOptions: {
      less: {
        math: "always", // 括号内才使用数学计算
        modifyVars: {
          hack: `true; @import './src/assets/publicStyle/index.less';`

        },

      }
    }
  }
})
